<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增系统 - 导航')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-mobileNav-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">数据ID：</label>
            <div class="col-sm-8">
                <input name="dataId" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数据类型：</label>
            <div class="col-sm-8">
                <input name="dataTpe"  class="form-control m-b" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">排序：</label>
            <div class="col-sm-8">
                <input name="display" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">名称：</label>
            <div class="col-sm-8">
                <input name="name" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">区域ID：</label>
            <div class="col-sm-8">
                <input name="areaId" class="form-control" type="text">
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">导航类型</label>
            <div class="col-sm-8">
                <select name="tpe" class="form-control m-b">
                    <option value="1">PC导航</option>
                    <option value="2">手机导航</option>
                    <option value="3">电视导航</option>
                </select>

            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">链接地址：</label>
            <div class="col-sm-8">
                <input name="link" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<input type="hidden" id="pid" name="pid" th:value="${id}">
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script type="text/javascript">
    var prefix = ctx + "system/mobileNav"

    function uploadFile() {
        var form = $("#form-mobileNav-add")[0];
        var formData = new FormData(form);
        var pid = $("#pid").val();
        formData.append('pid',pid);
        $.ajax({
            url: prefix + "/mobileNavAddType",
            type: 'post',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
            dataType: "json",
            success: function(result) {

                console.log(result)
                parent.location.reload();
            }
        });
    }

    $("#form-mobileNav-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        uploadFile();
    }

    $("input[name='addtime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>